﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RaygunDiplomacy.SpritesModule
{
   public abstract class ObjectStateToSpriteState
   {
      #region Fields

      protected int currentAnimation = 0;

      protected float animationPoint = 0;

      protected bool useCurrentFrame = false;

      #endregion

      #region Properties

      public int CurrentAnimation
      {
         get
         {
            return currentAnimation;
         }
      }

      public bool UseAnimationPoint
      {
         get
         {
            return useCurrentFrame;
         }
      }

      public float AnimationPoint
      {
         get
         {
            return animationPoint;
         }
      }

      public SlimDX.Vector3 PositionWorld { get; set; }

      public bool IsVisible { get; set; }

      #endregion

      #region Events

      private FastSubject<EventArgs> currentAnimationChanged = new FastSubject<EventArgs>();

      protected void OnCurrentAnimationChanged()
      {
         currentAnimationChanged.OnNext(EventArgs.Empty);
      }

      public IObservable<EventArgs> CurrentAnimationChanged
      {
         get { return currentAnimationChanged; }
      }

      private FastSubject<EventArgs> animationPointChanged = new FastSubject<EventArgs>();

      protected void OnAnimationPointChanged()
      {
         animationPointChanged.OnNext(EventArgs.Empty);
      }

      public IObservable<EventArgs> AnimationPointChanged
      {
         get { return animationPointChanged; }
      }

      #endregion

      public abstract void AnimationComplete(bool isLooping);

      public abstract void TransitionComplete(int nextAnimation);
   }
}
